import 'package:fluro/fluro.dart';
import 'package:flutter/cupertino.dart';
import 'routes_handler.dart';

class Routes {
  static void configureRoutes(FluroRouter router) {
    // 普通路由
    router.define('/', handler: indexHandler);
    router.define('/product_search',
        handler: productSearchHandler, transitionType: TransitionType.material);
    router.define('/product_list', handler: productListHandler);
    router.define('/product_detail',
        handler: productDetailHandler,
        transitionType: TransitionType.inFromLeft,
        transitionDuration: const Duration(milliseconds: 600));
    router.define('/product_comment', handler: productCommentHandler);
    router.define('/register', handler: registerHandler);
    router.define('/mine', handler: mineHandler);
    router.define('/category', handler: categoryHandler);
    router.define('/cart', handler: cartHandler);
    router.define('/profile', handler: profileHandler);
    router.define('/change_password', handler: changePasswordHandler);
    router.define('/login',
        handler: loginHandler, transitionType: TransitionType.custom,
        transitionBuilder: (context, animation, secondaryAnimation, child) {
      return FadeTransition(
        opacity: CurvedAnimation(parent: animation, curve: Curves.linear),
        child: child,
      );
    }, transitionDuration: const Duration(seconds: 1));
    router.define('/favorite', handler: favoriteHandler);
    router.define('/score', handler: scoreHandler);
    router.define('/coupon', handler: couponHandler);
    router.define('/address', handler: addressHandler);
    router.define('/address_add', handler: addressAddHandler);
    router.define('/order_confirm', handler: orderConfirmHandler);
    router.define('/order_pay', handler: orderPayHandler);
    router.define('/order_detail', handler: orderDetailHandler);
    router.define('/order_list', handler: orderListHandler);
    router.define('/order_comment', handler: orderCommentHandler);
    router.define('/splash', handler: splashHandler);

    router.notFoundHandler = unknownHandler;
  }
}
